home *** CD-ROM | disk | FTP | other *** search
- /*
- cvorder.cpp
-
- How to order dialog (adapted from FeatureView)
-
- C++/Views 2.0 Demo
- Copyright (c) 1992, by Liant Software Corp.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- */
-
- #include "cvorder.h"
- #include "cvdemovw.h"
- #include "editbox.h"
- #include "listbox.h"
- #include "pushbttn.h"
- #include "messengr.h"
- #include "font.h"
- #include "tagstrm.h"
-
- defineClass(OrderDialog, VDialog)
-
- OrderDialog::OrderDialog()
- {
- ;
- }
-
- OrderDialog::OrderDialog(VWindow *parent)
- : VDialog(5, 30, 250, 180, parent, StyleTitle | StyleCloseBox)
- {
- setTitle("How to Order C++/Views");
-
- listFont = new VFont("Arial", 10);
- listFont->bold(TRUE);
- msgFont = new VFont("Arial", 10);
-
- /* create a list box */
- listBox = new VListBox(VFrame(0.05F, 0.05F, 0.9F, 0.4F), this, StyleBorder);
- listBox->uponClick(this, methodOf(OrderDialog, singleClick),
- methodOf(OrderDialog, doubleClick));
-
- listBox->setFont(listFont);
-
- /* read in list of features from the message file */
- VTagStream tagStrm;
- VString cmd;
- VStream flist(cvTextFile->getMessage("Order:List"));
-
- tagStrm.beginScan(&flist, NIL);
- tagStrm.tags('(', ')');
-
- while(tagStrm.getTag(cmd)) {
- listBox->appendString(cmd.gets());
- }
-
- /* create an edit box */
- msgBox = new VEditBox(VFrame(0.05F, 0.5F, 0.9F, 0.35F), this,
- StyleBorder | StyleVertical | StyleWordWrap | StyleReadOnly);
-
- msgBox->setFont(msgFont);
-
- msgBox->putText(cvTextFile->getMessage("Order:Intro").gets());
-
- /* create OK button */
- VPushButton *okButton;
- okButton = new VPushButton(VFrame(0.5F, 0.9F, 50, 30, CenterDim), this, StyleDefault, "Ok");
- okButton->uponClick(this, methodOf(VDialog, ok));
- }
-
- OrderDialog::~OrderDialog()
- {
- delete listFont;
- delete msgFont;
- }
-
- boolean OrderDialog::free()
- {
- delete this;
- return(TRUE);
- }
-
- boolean OrderDialog::singleClick(int index)
- /*
- Mouse clicked on the list box
- */
- {
- VString idx("Order:");
- VString *temp;
-
- temp = listBox->selectedString();
- idx.concat(temp);
- delete temp;
-
- msgBox->putText(cvTextFile->getMessage(idx.gets()).gets());
- return(TRUE);
- }
-
- boolean OrderDialog::doubleClick(int index)
- /*
- Mouse double-clicked on the list box
- */
- {
- return(TRUE);
- }
-
-
-